<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管道式链接</title>
</head>
<body>
    <div id="app">
        <input type="text" name="msg" v-model="msg" />
        <div style="margin-top:20px;">
            过滤数字:<p>{{msg | fNum | arr}}</p>
        </div>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
    <script type="text/javascript">
        new Vue({
            el:'#app',
            data:{
                msg: ''
            },
            filters: {
                fNum(value){//过滤数字
                    return value.replace(/[0-9]/g,'*');
                },
                arr(val){
                    //将字符分割成数组
                    return val.split('');
                }
            }
        })
    </script>
</body>
</html>